package com.example.famhealing.timeline;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.famhealing.R;

public class ScrapListAdapter extends ArrayAdapter<ScrapList> {

	private ArrayList<ScrapList> items;

	public ScrapListAdapter(Context context, int textViewResourceId,
			ArrayList<ScrapList> items) {
		super(context, textViewResourceId, items);
		this.items = items;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {

			LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
					Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.timeline_scraplist, null);
		}
		ScrapList scrapList = items.get(position);

		if (scrapList != null) {
			
			TextView scrap_name=(TextView)v.findViewById(R.id.scrap_name);
			TextView scrap_date=(TextView)v.findViewById(R.id.scrap_date);
			TextView scrap_content=(TextView)v.findViewById(R.id.scrap_content);
			TextView scrap_title=(TextView)v.findViewById(R.id.scrap_title);
			TextView scrap_url=(TextView)v.findViewById(R.id.scrap_url);
			ImageView scrap_profile=(ImageView)v.findViewById(R.id.scrap_user_profile);
			ImageView scrap_img=(ImageView)v.findViewById(R.id.scrap_img);
			
			scrap_name.setText(scrapList.getName());
			scrap_date.setText(scrapList.getDate());
			scrap_content.setText(scrapList.getContent());
			scrap_title.setText(scrapList.getTitle());
			scrap_url.setText(scrapList.getUrl());
			
		}
		return v;
	}

}

class ScrapList {
	String name;
	String date;
	String writerimg;
	String content;
	String scrapimg;
	String title;
	String url;

	public ScrapList(String writerimg, String name, String date, String content, String scrapimg, String title, String url) {
		this.setContent(content);
		this.setWriterimg(writerimg);
		this.setDate(date);
		this.setName(name);
		this.setScrapimg(scrapimg);
		this.setTitle(title);
		this.setUrl(url);
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getWriterimg() {
		return writerimg;
	}

	public void setWriterimg(String writerimg) {
		this.writerimg = writerimg;
	}

	public String getScrapimg() {
		return scrapimg;
	}

	public void setScrapimg(String scrapimg) {
		this.scrapimg = scrapimg;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
}
